<template>
	<view class="">
		<view class="allbanner" style="position: relative;">
			<view class="bannercenter flexcolumn">
				<view class="bannerimgtext">
					<image src="@/static/image/system/f7xn.png" mode="" class=""></image>
				</view>
				<view class="bannertext3 margin_top">{{name}}</view>
			</view>
			<image :src="topimg" mode=""></image>
		</view>
		<!-- 分类 -->
		<view class="mainpadding">
			<view class=" flexleft flex_wrap">
				<view class="flexcolumn" style="width: 25%;" v-for="item in zyfu" :key="item.id"  @click="tzzyfw(item)">
					<view class="gjicon">
						<image :src="item.image_text" mode=""></image>
					</view>
					<view class="titletext textcenter margin_top2">{{item.name}}</view>
				</view>
			</view>
			<view class="margin_top mainpadding">
				<view class="titletext allxiahian">{{name}}</view>
				<view class="nostrongtext allxiahian margin_top2" v-for="item in child" :key="item.id" @click="tzgzzd(item.id,item)">{{item.name}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				topimg: "",
				name: "",
				child: [],
				zyfu:[]
			}
		},
		onLoad(options) {
			let data = JSON.parse(decodeURIComponent(options.data));
			this.child = data.child
			this.name = data.name
			this.getzyfu()
			this.getbanner() //轮播
		},
		methods: {
			getbanner() {
				httpRequest.request('/api/index/getAdvertiseList', 'POST', {
					advertise_position_id: 19,
					is_more: 2
				}, false, false, true).then(res => {
					this.topimg = res.data.image_text
				})
			},
			tzzyfw(item){
				this.name = item.name
				this.child = item.child
			},
			getzyfu(){
				httpRequest.request('/api/index/zyfwTypeIndex', 'GET', {
				}, false, false, true).then(res => {
					this.zyfu = res.data
				})
			},
			// 跳转规章制度
			tzgzzd(id,item) {
				let bg_image_text = ""
				this.zyfu.forEach(item=>{
					if(item.name==this.name){
						bg_image_text = item.bg_image_text
					}
				})
				uni.navigateTo({
					url: '/pages/index/guizhangzd?id='+id+"&bgimage_text="+bg_image_text
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.gjicon {
		margin: auto;
		width: 92rpx;
		height: 92rpx;
		border-radius: 50%;
	
		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}
	.fudongdw {
		position: absolute;
		bottom: 68rpx;
		left: 36%;
	}

	.ershiw {
		width: 25%;
	}

	.zyicon {
		margin: auto;
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.allicon {
		width: 100%;
		height: 600rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>